const path = require("path");

function resolve(dir) {
  return path.join(__dirname, dir);
}

module.exports = {
  publicPath: process.env.publicPath, // 资源路径
  outputDir: process.env.outputDir, //构建输出目录
  productionSourceMap: false, // 打包之后不需要生成map文件
  lintOnSave: false, // 是否开启eslint
  configureWebpack: {
    // 第三方插件的配置 【引用】 免打包
    externals: {
      'vue': "Vue",
      "vue-router": "VueRouter",
      'axios': "axios",
      'vuex': "Vuex",
    },
  },
  assetsDir: "cjml_im_h5",
  chainWebpack: (config) => {
    config.resolve.alias
      .set("~", resolve("node_modules"))
      .set("@", resolve("src"))
      .set("@assets", resolve("src/assets"))
      .set("@components", resolve("src/components"));
  },
  css: {
    loaderOptions: {
      less: {
        modifyVars: {
          "link-color": "#0e87f8",
          "btn-primary-color": "#fff",
          "btn-primary-bg": "#f5222d",
          "radio-dot-color": "#f5222d",
        },
        javascriptEnabled: true,
      },
    },
    sourceMap: true,
  },
};
